package 笔试记录.M8day27美团;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        String res_s = sc.next();
        String now_s = sc.next();
        int count = 0;
        if(m >= n){
            for(int i = 0;i < res_s.length();i++){
                if(solve1(res_s,i,now_s)){
                    count++;
                }
            }
            System.out.println(count);
        }else{
            System.out.println("输入异常");
        }
    }

    public static boolean solve1(String res_s,int index,String now_s){
        if(res_s.length() - index < now_s.length()) return false;
        int i = index;
        int j = 0;
        while(i < res_s.length() && j < now_s.length()){
            if(now_s.charAt(j) == '*' || res_s.charAt(i) == now_s.charAt(j)){
                i++;
                j++;
                continue;
            }else{
                    return false;
            }
        }
        return true;
    }
}
